import { createRouter, createWebHashHistory } from "vue-router";
import routeData from "./test"; // 引入测试数据的路由

const routes = [
  {
    path: '/',
    name: 'Home',
    redirect: 'Login',  // 使用重定向  为了是让在进入的时候路由没有内容的时候直接进入登录页
    hidden: true
  },
  // Login
  {
    path: '/login',
    name: 'Login',
    hidden: true,
    component: () => import("@/views/account/login")
  },
  {
    path: '/loading',
    name: 'Loading',
    hidden: true,
    component: () => import("@/views/loading/loading")
  },
  {
    path: '/layout',
    name: 'Layout',
    meta: {
      title: '控制台',
      icon: "home"
    },
    component: () => import("@/Layout/Index.vue"),
    children: [
      {
        path: '/console',
        name: 'Console',
        meta: {
          title: '首页'
        },
      component: () => import("@views/console/Index.vue"),
      }
    ]
  },
  {
    path: '/news',
    name: 'News',
    hidden: false,
    meta: {
      title: '信息管理',
      icon: "inforation"
    },
    component: () => import("@/Layout/Index.vue"),
    children: [
      {
        path: '/newsIndex',
        name: 'NewsIndex',
        meta: {
          title: '信息列表',
          icon: "InformationList"
        },
      component: () => import("@views/news/info/Index.vue"),
      },
      {
        path: '/newsCategory',
        name: 'NewsCategory',
        meta: {
          title: '信息分类',
          icon: "informationExtraction"
        },
      component: () => import("@views/news/info/Category.vue"),
      },
      {
        path: '/newsDetailed',
        name: 'NewsDetailed',
        hidden: true,
        meta: {
          title: '信息详情'
        },
      component: () => import("@views/news/info/Detailed.vue"),
      }
    ]
  },
  {
    path: '/user',
    name: 'User',
    meta: {
      title: '用户管理',
      icon: "user"
    },
    component: () => import("@/Layout/Index.vue"),
    children: [
      {
        path: '/userIndex',
        name: 'UserIndex',
        meta: {
          title: '用户列表'
        },
      component: () => import("@views/user/Index.vue"),
      }
    ]
  },
  {
    path: "/qrCode",
    name: "qrCode",
    meta: {
      title: "二维码"
    },
    component: () => import("@/views/qrCode")
  },
  // {
  //   path: "/computedTest",
  //   name: "computedTest",
  //   meta: {
  //       title: "计算属性测试组件",
  //       icon: ""
  //   },
  //   component: computedTest,
  // }
  ...routeData.testRoutes
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
